<?php

namespace app\admin\model\wanlshop;

use think\Model;
use traits\model\SoftDelete;


class QrcodeLog extends Model
{

    use SoftDelete;

    protected $pk = "id";

    // 表名
    protected $name = 'wanlshop_qrcode_log';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';
    // 追加属性
    protected $append = [
        'time_text',
    ];
    public function getTimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['updatetime']) ? $data['updatetime'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }
}
